import { createRouter, createWebHistory } from 'vue-router';

/**
 * 动态组件
 */
const vueFiles = import.meta.glob<typeof import('*.vue')>('./pages/*.vue');

/**
 * 主页面路由
 */
const routes_main = Object.keys(vueFiles).map(filePath => {
  const name = filePath.match(/pages\/(.*?).vue/)?.[1] || '';
  return {
    path: '/' + name,
    name: name,
    component: vueFiles[filePath],
  }
}).filter(item => item.path);

/**
 * 其它固定路由
 */
const routes_base = [
  
]

export default createRouter({
  history: createWebHistory(),
  routes: [
    ...routes_main,
    // ...routes_base,
  ],
});